$(document).ready(function () {
    let rows = 30
    let cell = 50

    for (let rowIndex = 0; rowIndex < rows; rowIndex++) {
        let rowDiv = $("<div>")
        $(".plate").append(rowDiv)
        rowDiv.addClass('rowdiv')

        for (let cellIndex = 0; cellIndex < cell; cellIndex++) {
            let cellDiv = $("<div>")
            cellDiv.css({
                "height": "20px",
                "width": "20px",
                "border": "1px #ffffff solid",
                "background-color": "red"
            })
            cellDiv.addClass("row_" + rowIndex)
            cellDiv.addClass("cell_" + cellIndex)
            rowDiv.append(cellDiv)
        }
        let player = {
            nikeName: "极道帝龙",
            speed:500,
            head:"R",
            position: [{
                x: 0,
                y: 0
            },{
                x: 0,
                y: 1
            },{
                x: 0,
                y: 2
            }
     ],
            color: "123123"
        }
        player.position.forEach(value => {
            let cell = $(".row_" + value.x + ".cell_" + value.y).css({
                "background-color": "#" + player.color
            })
            function move(){
                console.log("我move了");
                setTimeout(()=>{
                    console.log("我执行了");
                    move();
                
                },player.speed)
            }
            move()
        })
    }
})